<!DOCTYPE html>
<html lang="zh-CN">
<?php include './application/views/common/zhs_header.php';?>
<body>
<div class="reg_header w"><h2>已有账户，<a class="red" href="/user/zhs_center.html">马上登录</a>  |  <a href="/">返回!@#$%树首页</a></h2></div>
<div class="regn_box w">
  <div class="logimg"><img src="static/zhsjr/images/log_5.gif"></div>
  <div class="regn_bd">
  <form id="reg_form">
  <input type="hidden" name="act" value="reg" />
    <ul>
      <!--<li><input class="inp_reg" id="add" type="text" value="用户名，必须含有字母，其中只允许0~9!#$^&?_字符" name="username" maxlength="16"></li>-->
      <li><span>用户账号</span><div class="inn01"><input class="inp_reg" id="phones" type="text" value="手机号码" name="phones" maxlength="15"></div>
        <!--<a class="yzmbtn red" href="javascript:;" onclick="phoneSubmit();" id="phone_code">获取验证码</a>
      --></li>
      <li><span>用户密码</span><div class="inn02">
       <input class="inp_reg" id="txt1" type="text" value="数字+字母组合能有效提升您的账户安全性" >
       <input class="inp_reg" id="pwd1" type="password" style="display:none" name="password" maxlength="20"></div>
      </li>
      <li><span>确认密码</span> <div class="inn03"><input class="inp_reg" id="txt2" type="text" value="确认密码" >
      <input class="inp_reg" id="pwd2" type="password" style="display:none" name="password2" maxlength="20"></div>
      </li>
      <!--<li><input class="inp_reg" id="lzm" type="text" value="验证码" name="lzmm">
         <div class="yzm"><a href="#"><img src="static/zhsjr/images/reg_1.gif"></a><a class="rg" href="#"><img src="static/zhsjr/images/reg_2.gif"></a></div>
      </li>-->
      
      <li>
      <span>验证码</span><div class="inn04">
      <input class="inp_reg011" style="margin-left:2px" id="captcha" name="captcha" type="text" value=""></div>
       <span><img src="http://%77%77%77%2E%7A%68%73%6A%72%2E%63%6F%6D/yanzheng" id="imgCode" onclick="changeImage();"  style="cursor: pointer;" /></span>
       </li>
       
      
      <li><span>手机验证码  </span><div class="inn04">
      <input class="inp_reg011" id="verify_code" type="text" value="手机验证码" name="verify_code" maxlength="6"></div>
      <a class="regbtn0" style="margin-top:2px; float:left;" href="javascript:;" onclick="phoneSubmit();" id="phone_code">获取验证码</a>
      </li>
       
       <li><span>推荐人编码</span><div class="inn05">
      <input class="inp_reg" style="margin-left:2px" id="tjrm" type="text" value="<?php if ($invite) echo $invite; else echo "推荐人编码"?>" name="invite" <?php
			if ($invite) { 
				echo("readonly=\"readonly\"");
			}
			?>
       maxlength="12"></div></li>
      <li><input style="border:0px #fff solid;" class="regra" type="checkbox" value="1" name="agr" checked="checked"><a href="#">我已阅读并同意《!@#$%树金融网站服务协议》</a></li>
      <li><a class="regbtn" href="javascript:;"  onclick="reg_submit();">马上注册</a></li>
      <h4>温馨提示：<br>
	1.用户账号请使用您的手机号，注册成功，不建议修改您的手机号；<br>
	2.登录密码可以有特殊字符，不能有空格；<br>
	3.如果因为不明原因收不到手机验证码，您可以稍候重新注册或者直接联系客服。</h4>
    </ul>
    </form>
  </div>
</div> 
<!-- Reg Footer End -->
<script type="text/javascript">

$(function () {
	var inp = $('input');
	inp.keypress(function (e) { 
	    var key = e.which; 
	    if (key == 13) {
	    	reg_submit();
	    }
	});
});


function reg_submit(){
	
	var options = {
		url : '/reg',
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg==''){
				$('#dialog').dialog({
					modal:true, //蒙层（弹出会影响页面大小）
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}},
					//ui-dialog-titlebar-close 
					close: function() {
						//location=ret.data.url;
						if(ret.data.url==''){
							window.location.reload();
						}else{
							window.location=ret.data.url;
						}
					}
				}); 
				$("#msg").html("注册成功，请尽快完成实名认证，提高账号安全！");
			}else{
				$('#dialog').dialog({
					modal:true, //蒙层（弹出会影响页面大小）
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}}
					//ui-dialog-titlebar-close 
				}); 
				$("#msg").html(ret.msg);
			}
		}
	};
	$("#reg_form").ajaxSubmit(options);
	
	var _mvq = window._mvq || []; 
	window._mvq = _mvq;
	_mvq.push(['$setAccount', 'm-119831-0']);

	_mvq.push(['$setGeneral', 'registered', '', /*用户名*/ 'phone', /*用户id*/ Math.random()]);
	_mvq.push(['$logConversion']);
		
	return false;
}


function get_length(s){
	var l = 0;
	var a = s.split("");
	for (var i=0;i<a.length;i++) {
	 if (a[i].charCodeAt(0)<299) {
	  l++;
	 } else {
	  l+=3;
	 }
	}
	return l;
}
function phoneSubmit(){
	if($('#phones').val()=='' || $("#phones").val() == "手机号码"){
		$('#dialog').dialog({
			modal:true, //蒙层（弹出会影响页面大小）
			title:'系统提示',
			buttons:{"确定":function(){$(this).dialog("close");}},
			close: function() {
			}
		}); 
		$("#msg").html("请输入手机号码");
		$("#phone").focus();
		return false;
	}else{
			$("#phone_code").html('处理中，请等待');
			$.ajax({
			type: "post",
			url: "/reg/apply_phone/",
			data: "phone="+$("#phones").val()+"&captcha="+$("#captcha").val(),
			success: function(ret){
				if(ret.info == 1){
					alert("验证码已发送,请查收");
					phone_countdown();
				}else{
					changeImage();
					alert(ret.msg);
					setTimeout(function(){
						$("#phone_code").html('重新获取验证码');
						},3000);
				}
			},
			dataType: "json"
		});	
	}
}

function phone_countdown(){
	var count = 180;
	var countdown = setInterval(CountDown, 1000); 
	function CountDown() {
		$("#phone_code").html('请等待 <font style="color:#a71e32;">'+count+"</font>秒");
		if (count == 0) {
			$("#phone_code").html('<a href="javascript:;" onclick="phoneSubmit();"> 重新获取验证码</a>');
			clearInterval(countdown);
		}
		count--;
	}
}

</script>
<?php include './application/views/common/zhs_footer.php';?>
<?php include './application/views/common/zhs_right.php';?>
</body>
</html>
